import Vue from 'vue'
import App from './App.vue'
import router from './router'
// 树形插件
import TreeTable from 'vue-table-with-tree-grid'

Vue.filter('dateFormat', function (originVal) {
  const dt = new Date(originVal)
  
  const y = dt.getFullYear()
  const m = (dt.getMonth() + 1 + '').padStart(2, '0')
  const d = (dt.getDate() + '').padStart(2, '0')
  
  const hh = (dt.getHours() + '').padStart(2, '0')
  const mm = (dt.getMinutes() + '').padStart(2, '0')
  const ss = (dt.getSeconds() + '').padStart(2, '0')
  
  return `${y}-${m}-${d} ${hh}:${mm}:${ss}`
});

// 引入element-ui
import 'element-ui/lib/theme-chalk/index.css';
import { Button } from 'element-ui';
import { Form } from 'element-ui';
import { FormItem } from 'element-ui';
import { Input } from 'element-ui';
import { Message } from 'element-ui';
import { Header } from 'element-ui';
import { Container } from 'element-ui';
import { Aside } from 'element-ui';
import { Main } from 'element-ui';
import { Menu } from 'element-ui';
import { Submenu } from 'element-ui';
import {
  MenuItem,
  MenuItemGroup,
  InputNumber,
  Breadcrumb,
  BreadcrumbItem,
  Card,
  Row,
  Col,
  Table,
  TableColumn,
  Switch,
  Tooltip,
  Pagination,
  Dialog,
  MessageBox,
  Tag,
  Tree,
  Option,
  Select,
  Cascader,
  Alert,
  TabPane,
  Tabs,
  Steps,
  Step,
  CheckboxGroup,
  Checkbox,
  Upload,
  Timeline,
  TimelineItem
} from 'element-ui';



// 导入字体图标库
import './assets/fonts/iconfont.css'

// 入口文件
// 引入全局样式表
import '../src/assets/css/global.css'

// 富文本编辑器
  import VueQuillEditor from 'vue-quill-editor';
// 富文本编辑器 的样式
    import 'quill/dist/quill.core.css'

    import 'quill/dist/quill.snow.css'

    import 'quill/dist/quill.bubble.css'



// axios配置
import axios from 'axios'
// 配置请求的根路径
axios.defaults.baseURL = 'http://127.0.0.1:8888/api/private/v1/'
// 挂载请求拦截器
axios.interceptors.request.use(config => {
  // console.log(config);
  config.headers.Authorization = window.sessionStorage.getItem('token')
return config;

});
// 把axios挂载到vue的原型对象上 
Vue.prototype.$http = axios

// 树形插件
Vue.component('tree-table', TreeTable)
// 注册全局的富文本编辑器
Vue.use(VueQuillEditor)
// 注册为全局组件
Vue
  .use(Button)
  .use(Form)
  .use(Input)
  .use(FormItem)
  .use(Header)
  .use(Container)
  .use(Aside)
  .use(Main)
  .use(Menu)
  .use(Submenu)
  .use(MenuItem)
  .use(MenuItemGroup)
  .use(InputNumber)
  .use(Breadcrumb)
  .use(BreadcrumbItem)
  .use(Card)
  .use(Row)
  .use(Col)
  .use(Table)
  .use(TableColumn)
  .use(Switch)
  .use(Tooltip)
  .use(Pagination)
  .use(Dialog)
  .use(Tag)
  .use(Tree)
  .use(Option)
  .use(Select)
  .use(Cascader)
  .use(Alert)
  .use(TabPane)
  .use(Tabs)
  .use(Steps)
  .use(Step)
  .use(CheckboxGroup)
  .use(Checkbox)
  .use(Upload)
  .use(Timeline)
  .use(TimelineItem)






Vue.prototype.$message = Message;
Vue.prototype.$confirm = MessageBox.confirm;
  


Vue.config.productionTip = false

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
